#include"Animation.h"

/////////////////
//include
/////////////////

/////////////////
//prottype
/////////////////

/////////////////
//const
/////////////////


Animation::Animation(Texture2D* tex,int tex_width_x,int tex_height_y)
{
	this->tex = tex;
	this->tex_num.x = tex_width_x;
	this->tex_num.y = tex_height_y;
	this->now_rect_num = Vector2D();
	this->rect_size = Vector2D(tex->GetSize().x/ tex_width_x,tex->GetSize().y/tex_height_y);
}
Animation::~Animation()
{

}
void Animation::SetCount(int count)
{
	now_rect_num.x = (int)(count%(int)tex_num.x);
	now_rect_num.y = (int)(count/(int)tex_num.x);
}
void Animation::Loop()
{
	if(!IsEnd())
		return;
	now_rect_num.x = 0;
	now_rect_num.y = 0;
}
void Animation::Next()
{
	if((int)now_rect_num.x < (int)(tex_num.x)-1)
	{
		now_rect_num.x++;
		return;
	}
	if((int)now_rect_num.y < (int)tex_num.y)
	{
		now_rect_num.y++;
		now_rect_num.x = 0;
		return;
	}
	
}